package com.cedarhd.finance.msg.common;


import com.cedarhd.finance.msg.common.enums.ResultCode;

/**
 *
 * @author Evan
 * @date 17/10/30
 */
public class JsonResult<T> {

    public String resultCode;
    public String msg;
    public Long size = 1L;
    public T result;

    public static JsonResult renderMsg(ResultCode code, Object data) {
        JsonResult result = new JsonResult();

        result.resultCode = code.getCode();
        result.msg = code.getMsg();
        result.result = data;

        return result;
    }


    public static JsonResult getSucMsg(Object data) {
        return renderMsg(ResultCode.SUCC, data);
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.result = result;
    }

}
